#ifndef __SYNC_SHARED_MEMORY_HPP__
#define __SYNC_SHARED_MEMORY_HPP__

#include "shared_memory.hpp"
#include "semaphore_vector.hpp"

namespace ipc {
	template <typename T, int PERMITS, int FLAGS,>
	class sync_shared_memory {
		protected:
			ipc::semaphore_vector::semaphore& mutex;
			ipc::shared_memory& shm<T,PERMITS,FLAGS>

			sync_shared_memory(const sync_shared_memory& other);
			sync_shared_memory& operator= (const sync_shared_memory& other);
		public:
			~shared_memory() {}

			operator bool () const {
				return (* (this->shm) );
			}

			bool is_null() const {
				return this->shm->is_null;
			}

			sync_shared_memory(shared_memory<T,PERMITS,FLAGS>& m, semaphore_vector::semaphore& s) : shm(m), mutex(s) {
			} 

			const T& operator*() const {
				return *(this->dato);
			}
			T& operator*() {
				return *(this->dato);
			}

	};
}

#endif

